﻿using System;

namespace Database.Sql.Attributes
{
  [AttributeUsage(AttributeTargets.Property)]
  public class TVPSqlType : Attribute
  {
    public Type SqlType { get; set; }

    public TVPSqlType(Type sqlType)
    {
      if(sqlType.Namespace != "System.Data.SqlTypes")
      {
        throw new ArgumentException(
          $"sqlType must be a member of: System.Data.SqlTypes. sqlType Namespace: {sqlType.Namespace}", nameof(sqlType));
      }

      SqlType = sqlType;
    }
  }
}
